textview: Fix blinking block cursors
authorMatthias Clasen <mclasen@redhat.com>
Sat, 13 Mar 2021 00:44:31 +0000 (19:44 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 13 Mar 2021 00:44:31 +0000 (19:44 -0500)
When we have a block cursor, we need to discard the
cached node of the line containing the cursor, in order
to get a blinking cursor.

gtk/gtktextlayout.c

index 9c994137aeab480a8f1ed573ae6ef7f28a43e2af..027ae9ca7407279f8d64cbd1680ab1bebb703a3c 100644 (file)
@@ -4232,6 +4232,13 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
                 selection_end_index = -1;
             }
 
+          if (line_display->node != NULL)
+            {
+              if (line_display->has_block_cursor &&
+                  gtk_widget_has_focus (widget))
+                g_clear_pointer (&line_display->node, gsk_render_node_unref);
+            }
+
           if (line_display->node == NULL)
             {
               gtk_snapshot_push_collect (snapshot);